package com.bolovan.infovaluta.action;

import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.StreamingResolution;
import net.sourceforge.stripes.action.UrlBinding;

import org.apache.log4j.Logger;

import com.bolovan.infovaluta.bean.ExchangeRate;
import com.bolovan.infovaluta.bean.ExchangeRateSeller;
import com.bolovan.infovaluta.util.RateMaps;
import com.bolovan.infovaluta.util.RateUtil;

@UrlBinding("/api/bce.action")
public class BceRates extends BaseAction {
	private static final Logger log = Logger.getLogger(BceRates.class.getName());

	@DefaultHandler
	public Resolution bce() {
		ExchangeRate bce = RateMaps.bce;
		if (bce == null) {
			bce = RateMaps.parseMap(ExchangeRateSeller.BCE);
		}
		return new StreamingResolution("json", RateUtil.toJsonString(bce));
	}
}
